<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <title>Zend_Server_Reflection - Zend Framework Manual</title>

    <link href="../css/shCore.css" rel="stylesheet" type="text/css" />
    <link href="../css/shThemeDefault.css" rel="stylesheet" type="text/css" />
    <link href="../css/styles.css" media="all" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>Zend Framework</h1>
<h2>Programmer's Reference Guide</h2>
<ul>
    <li><a href="../en/zend.server.reflection.html">Inglês (English)</a></li>
    <li><a href="../pt-br/zend.server.reflection.html">Português Brasileiro (Brazilian Portuguese)</a></li>
</ul>
<table width="100%">
    <tr valign="top">
        <td width="85%">
            <table width="100%">
                <tr>
                    <td width="25%" style="text-align: left;">
                    <a href="zend.server.introduction.html">Introduction</a>
                    </td>

                    <td width="50%" style="text-align: center;">
                        <div class="up"><span class="up"><a href="zend.server.html">Zend_Server</a></span><br />
                        <span class="home"><a href="manual.html">Programmer's Reference Guide</a></span></div>
                    </td>

                    <td width="25%" style="text-align: right;">
                        <div class="next" style="text-align: right; float: right;"><a href="zend.service.html">Zend_Service</a></div>
                    </td>
                </tr>
            </table>
<hr />
<div id="zend.server.reflection" class="section"><div class="info"><h1 class="title">Zend_Server_Reflection</h1></div>
    

    <div class="section" id="zend.server.reflection.introduction"><div class="info"><h1 class="title">Introduction</h1></div>
        

        <p class="para">
            <span class="classname">Zend_Server_Reflection</span> provides a standard mechanism for
            performing function and class introspection for use with server classes. It is
            based on <acronym class="acronym">PHP</acronym> 5&#039;s Reflection <acronym class="acronym">API</acronym>, augmenting it
            with methods for retrieving parameter and return value types and descriptions, a
            full list of function and method prototypes (i.e., all possible
            valid calling combinations), and function or method descriptions.
        </p>

        <p class="para">
            Typically, this functionality will only be used by developers of
            server classes for the framework.
        </p>
    </div>

    <div class="section" id="zend.server.reflection.usage"><div class="info"><h1 class="title">Usage</h1></div>
        

        <p class="para">
            Basic usage is simple:
        </p>

        <pre class="programlisting brush: php">
$class    = Zend_Server_Reflection::reflectClass(&#039;My_Class&#039;);
$function = Zend_Server_Reflection::reflectFunction(&#039;my_function&#039;);

// Get prototypes
$prototypes = $reflection-&gt;getPrototypes();

// Loop through each prototype for the function
foreach ($prototypes as $prototype) {

    // Get prototype return type
    echo &quot;Return type: &quot;, $prototype-&gt;getReturnType(), &quot;\n&quot;;

    // Get prototype parameters
    $parameters = $prototype-&gt;getParameters();

    echo &quot;Parameters: \n&quot;;
    foreach ($parameters as $parameter) {
        // Get parameter type
        echo &quot;    &quot;, $parameter-&gt;getType(), &quot;\n&quot;;
    }
}

// Get namespace for a class, function, or method.
// Namespaces may be set at instantiation time (second argument), or using
// setNamespace()
$reflection-&gt;getNamespace();
</pre>


        <p class="para">
             <span class="methodname">reflectFunction()</span> returns a
            <span class="classname">Zend_Server_Reflection_Function</span> object;
             <span class="methodname">reflectClass()</span> returns a
            <span class="classname">Zend_Server_Reflection_Class</span> object. Please refer to
            the <acronym class="acronym">API</acronym> documentation to see what methods are available to each.
        </p>
    </div>
</div>
        <hr />

            <table width="100%">
                <tr>
                    <td width="25%" style="text-align: left;">
                    <a href="zend.server.introduction.html">Introduction</a>
                    </td>

                    <td width="50%" style="text-align: center;">
                        <div class="up"><span class="up"><a href="zend.server.html">Zend_Server</a></span><br />
                        <span class="home"><a href="manual.html">Programmer's Reference Guide</a></span></div>
                    </td>

                    <td width="25%" style="text-align: right;">
                        <div class="next" style="text-align: right; float: right;"><a href="zend.service.html">Zend_Service</a></div>
                    </td>
                </tr>
            </table>
</td>
        <td style="font-size: smaller;" width="15%"> <style type="text/css">
#leftbar {
	float: left;
	width: 186px;
	padding: 5px;
	font-size: smaller;
}
ul.toc {
	margin: 0px 5px 5px 5px;
	padding: 0px;
}
ul.toc li {
	font-size: 85%;
	margin: 1px 0 1px 1px;
	padding: 1px 0 1px 11px;
	list-style-type: none;
	background-repeat: no-repeat;
	background-position: center left;
}
ul.toc li.header {
	font-size: 115%;
	padding: 5px 0px 5px 11px;
	border-bottom: 1px solid #cccccc;
	margin-bottom: 5px;
}
ul.toc li.active {
	font-weight: bold;
}
ul.toc li a {
	text-decoration: none;
}
ul.toc li a:hover {
	text-decoration: underline;
}
</style>
 <ul class="toc">
  <li class="header home"><a href="manual.html">Programmer's Reference Guide</a></li>
  <li class="header up"><a href="manual.html">Programmer's Reference Guide</a></li>
  <li class="header up"><a href="reference.html">Zend Framework Reference</a></li>
  <li class="header up"><a href="zend.server.html">Zend_Server</a></li>
  <li><a href="zend.server.introduction.html">Introduction</a></li>
  <li class="active"><a href="zend.server.reflection.html">Zend_Server_Reflection</a></li>
 </ul>
 </td>
    </tr>
</table>

<script type="text/javascript" src="../js/shCore.js"></script>
<script type="text/javascript" src="../js/shAutoloader.js"></script>
<script type="text/javascript" src="../js/main.js"></script>

</body>
</html>